<?php $this->load->view('_header') ?>

<script language="javascript" type="text/javascript" src="<?php echo site_url('js/validator.js')?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo site_url('js/flight.js')?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo site_url('js/formValidator_min.js')?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo site_url('js/formValidatorRegex.js')?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo site_url('js/national.js')?>"></script>

<div class="Main">
<div id="flightleft"><?php $this->load->view("queryframe");?></div>
<div id="flightright"><?php 
	
	echo form_open('order/createorder',array('id' => 'formbook'));
	
	?><div style="text-align:right"><img src="<?php echo site_url('images/A3.gif')?>" /></div><BR>
	<div class="flightbox1">&nbsp;&nbsp;
		<?=lang('home_From')?>:<?php echo $sFromcitycode?><span style="width:35px;"></span>
		<?=lang('home_To')?>:<?php echo $sDestcitycode?><span style="width:35px"></span>
		<?=lang('home_Depart')?>:<?php echo $sDepartDate;?><span style="width:35px"></span>
		<?=lang('home_Return')?>:<?php echo $sReturnDate;?>
	</div>
	<div id="dvmainflight" style="padding:4px 0 0 4px;">
	<table border=0 >
		<tr height=34 class="trair" align=center>
			<td width=80 ><?=lang("home_Depart")?></td>
			<td width=120 ><?=lang("FlightNo/Airline")?></td>
			<td width=145 ><?=lang("Depart/Arrival")?></td>
			<td width=70 ><?=lang("Class")?></td>
			<td width=70 ><?=lang("Plane/Stop")?></td>
			<td width=90 ><?=lang("Fare")?></td>
			<td width=78 ><?=lang("Tax&Fee")?></td>
			<td width=78 ><?=lang("rebate&vip Price")?></td>
			<td width=90 <?=lang("TotalPrice")?></td>
		</tr><?php
		$maxseat=1;
		foreach($arairinfo as $item)
		{
		?><tr height=55 class="trdash" align=center>
			<td><?=Date("Y-m-d",strtotime($item["flightdate"]));?></td>
			<td align=left style="padding-left:5px" ><?php echo "<img style=\"float:left\" width=25 height=25 src=\"".site_url("images/airlines/".$item["Airline"].".gif")."\" alt='".$item["Airline"]."' />".$item["FlightNo"] ?></td>
			<td align=left nowrap ><?php echo $item["Depart"]."&nbsp;".$item["fromportName"].'<br/>'.$item["Arrival"]."&nbsp;".$item["destportName"]; ?></td>
			<td><?php echo $item["class"][0][0]; ?></td>
			<td><?php echo $item["Plane"].'/'.$item["Stop"]; ?></td>
			
			<td><?php
			$itotalprice=0;
			//$itotalprice=$item["class"][0][2];
			$itotalprice=$item["cost"];
			$maxseat	=$item["class"][0][1];	
			echo $item["class"][0][2];
			if($item["OilFee"]<0)
			{
				$item["OilFee"]=0;
			}
			//计算总价
			$itotalprice+=$item["OilFee"]+$item["AirportFee"];
			?></td>
			<td><?php echo $item["OilFee"].'+'.$item["AirportFee"]; ?></td>
			<td><?php 
			echo $item["rebate"]."%/".$item["cost"];
			?></td>
			<td><?php echo $mainCurrency.":".$itotalprice;?></td>
		 </tr>
		 <?
		}
		 ?><tr>
		 	<td colspan=9 align=left ><?php
		 	echo $TGQNote;	
		 	?></td>	
		 </tr>
	</table>
		
	</div><!--航班信息显示结束-->
	
	<div id="dvbook" style="padding-top:19px">
		<table border=0 width=724 >
			<tr>
				<td><span class="tiptitle"><?=lang("PassengerInfomation")?></span></td>
				<td align="right"><?=lang("PassengerNum")?>:
				<?php
				for($i=0;$i< $maxseat;$i++)
				{
					$options[$i]=$i+1;
				}
				echo form_dropdown('Passnum', $options, 'large',' onchange="setpassengernum(this);"');
				?></td>
			</tr>	
		</table>
		
		<table border=0 width=724 class="ordertable" bordercolor=#DFDFDF  id="tbPassenger_1">
			<tr height=2 class="booktitle"  >
				<th></th>	
			</tr>
		</table>
	</div>
	<!--预订信息填写结束-->
	<div id="dvbook" style="padding-top:19px">
		<span class="tiptitle"><?=lang("ContactInfomation")?></span>
		<table border=0 width=724 class="contactable" bordercolor=#DFDFDF >
			<tr height=32 align=left >
				<td width=230 align=right ><span class="txred">*</span><?=lang("book_Name")?>&nbsp;</td>
				<td width=215 ><input type=text id="txLinkMan" name="LinkMan" verify="M" desc="Name" value="<?=set_value("LinkMan",$txLinkMan)?>" class="txd" /></td>
				<td width=275 ><div id="txLinkManTip"></div></td>
			</tr>
			
			<tr height=32>
				<td align=right><span class="txred">*</span><?=lang("book_Mobilephone")?>1&nbsp;</td>
				<td><input type=text id="txMobilephone1" name="Mobilephone1" verify="M"  desc="mobile" value="<?=set_value("LinkMan",$txmobile)?>" maxlength=11 class="txd" /></td>
				<td><div id="txMobilephone1Tip"></div></td>
			</tr>
			
			<tr height=32>
				<td align=right><?=lang("book_Mobilephone")?>2&nbsp;</td>
				<td><input type=text id="txMobilephone2" name="Mobilephone2" class="txd" value="<?=set_value("LinkMan",$txmobile2)?>" /></td>
				<td><div id="txMobilephone2Tip"></div></td>
			</tr>
			
			<tr height=32 >
				<td align=right><span class="txred">*</span>Email&nbsp;</td>
				<td><input type=text id="txEmail" name="Email" verify="M,email" desc="email" class="txd" value="<?=set_value("LinkMan",$txEmail)?>" /></td>
				<td><div id="txEmailTip"></div></td>
			</tr>

		</table>
	</div>
	<!--联系信息填写结束-->
	<div id="dvPrice" class="bookprice" style="margin-top:20px">
		Grand for total <span id=spPassenger></span> person(all taxes and fees includes):<?=$mainCurrency?>:<span id=spTotalprice></span>
	</div>
	<!--价格信息填写结束-->
	<div style="text-align:center;padding:10px"><input type="button" name="bbb" id="btn_create" onclick="confirmairTicket();" class="btn3" value="<?=lang("PostBooking")?>" /></div>
	<input type=hidden name="TotalAdult" id="hdn_totalAdult" value="1" />
	<input type=hidden name="eachprice" id="hdn_eachprice" value="<?php echo $itotalprice?>" />
	<input type=hidden name="go_flightinfo" id="hdn_goflightinfo" value="<?php echo $flightdata?>" />
	<input type=hidden name="back_flightinfo" id="hdn_backflightinfo" value="<?php echo $flightbackdata;?>" />
	<input type=hidden name="maxseat" id="hdn_maxseat" value="<?=$maxseat?>" />
	<?php
	echo form_close();
	?>
</div>
<div class="clear"></div>	
</div>

<table style="display:none;" id="tbModel_1" >
	<tr height=28 align=left ><td>
		<div style="background:#E9EBF1;padding:10px" >
		<table border=0  width=100% >
			<tr align=left height=28 >
				<td align="right" ><span class="txred">*</span><?=lang("book_Name")?>&nbsp;&nbsp;</td>
				<td width=210 ><input type=text id="PassengerName_REPLACE_INDEX" class="txd" verify="M" desc="Passenger Name"  name="PassengerName[]" onfocus="clearTxt(this,'Tom/Wang');" onBlur="fillTxt(this,'Tom/Wang');" style="color:gray" value="Tom/Wang" /></td>
				<td align="right"><span class="txred">*</span><?=lang("book_Mobilephone")?>&nbsp;&nbsp;<input type=hidden name="PassengerType[]" value="0" id='PassengerType_REPLACE_INDEX' >
					<input type=hidden id="Serrial_REPLACE_INDEX" name="Serrial[]" value="" ></td>
				<td><input type="text" id="PassengerTel_REPLACE_INDEX" name="PassengerTel[]" verify="M"  desc="mobile" maxlength=11 class="txd" style="width:230px;"></td>
			</tr>
			
			<tr align=left height=28 >
				<td align="right"><span class="txred">*</span><?=lang("book_Nationality")?>&nbsp;&nbsp;</td>
				<td ><select style="width:155px" verify="M" desc="<?=lang("book_Nationality")?>" class="selnational" name="PI_userNationality[]">					
				</select></td>
				<td align="right"><span class="txred">*</span><?=lang("book_Gender")?>&nbsp;&nbsp;</td>
				<td>
                      <select name="PI_userGender[]" verify="M" desc="<?=lang("book_Gender")?>" style="width: 62px;">                                          
                        <option value=""></option>
                        <option value="M">Male</option>
                        <option value="F">Female</option>
                    </select>
                    &nbsp;&nbsp;<span class="txred">*</span><?=lang("book_Dateofbirth")?>&nbsp;
                    <input name="PI_userBirth[]" type="text" verify="M,Custom" regexp="^((((19|20)\d{2})-(0?(1|[3-9])|1[012])-(0?[1-9]|[12]\d|30))|(((19|20)\d{2})-(0?[13578]|1[02])-31)|(((19|20)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))-0?2-29))$" Errmsg="error,such as 2011-01-01" desc="<?=lang("book_Dateofbirth")?>" class="txd" onfocus="clearTxt(this,'yyyy-mm-dd')" onBlur="fillTxt(this,'yyyy-mm-dd');" value="yyyy-mm-dd" style="color:gray;width:65px;font-size:9pt" /><BR/></td>
			</tr>
			<tr align=left height=28 ><td align="right"><?=lang("book_IDType")?>&nbsp;&nbsp;</td>
	                <td><?=$selCTType;?></td>
	                <td align="right"><span class="txred">*</span><?=lang("book_IDNumber")?>&nbsp;&nbsp;</td>
	                <td><input type=text name="CTID[]" verify="M" desc="ID Number" id="CTID_REPLACE_INDEX"  style="width:230px;" class=txd /></td>
	          </tr>
	          
	          <tr align=left height=28 >
	                <td align="right"><span class="txred">*</span><?=lang("book_IDexpirationdate")?>&nbsp;&nbsp;</td>
	                <td align=left><input name="PI_idExpiration[]" type="text" verify="M,Custom" regexp="^((((19|20)\d{2})-(0?(1|[3-9])|1[012])-(0?[1-9]|[12]\d|30))|(((19|20)\d{2})-(0?[13578]|1[02])-31)|(((19|20)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))-0?2-29))$" Errmsg="error,such as 2011-01-01" desc="<?=lang("book_IDexpirationdate")?>" style="width:75px"  class="txd"  />yyyy-mm-dd</td>
	               
	                <td align="right">
	                    <?=lang("book_Passporttype")?>&nbsp;&nbsp;</td>
	                <td>
	                    <select name="PI_passType[]" type="text" style="width:230px;">
	                    	<option value="Regular(P)">Regular(P)</option>
	                    	<option value="Oficial(I)">Oficial(I)</option>
	                    	<option value="Diplomatic(D)">Diplomatic(D)</option>
	                    </select>
	                </td>
	            </tr>
			</table>
			</div>
			<div style="background:#fff;height:5px" ></div>
	</td></tr>
 </table>
<script language="javascript">
	$(document).ready(function(){
		init_selnational("China||CN");
	});
	var jValue,iMaxI=0;
	addmodelbyIndex(1,iMaxI);
	jValue={
			"Serrial":iMaxI++,
			"PassengerName":"",
			"PassengerType":"0",
			"CTType":"0",
			"CTID":"",
			"Note":"",
			"PTel":""
		};
	setAirTicketValue(iMaxI-1,jValue);
</script>
<?php $this->load->view('_footer') ?>